[PHP] missing keys in $_POST
Posted
by KPL
on Stack Overflow
See other posts from Stack Overflow
or by KPL
Published on 2010-04-03T14:55:20Z
Indexed on
2010/04/03
15:03 UTC
Read the original article
Hit count: 388
Hello there,
I am trying to get some form data from POST method.
Here's the code of form -
<form action="" method="post" name="form1" id="form1">
<input type="hidden" value="15" name="ad_id">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="block">
<tbody><tr>
<td valign="top"> </td>
<td align="right">all fields are required</td>
</tr>
<tr>
<td valign="top"> </td>
<td align="center"></td>
</tr>
<tr>
<td valign="top" width="150"><label for="name">Advertisement Name</label>
*</td>
<td><input type="text" size="45" value="Banner" id="name" name="name">
e.g Home Banner</td>
</tr>
<tr>
<td valign="top"><label for="placement">Advertisement Placement</label></td>
<td><select id="placement" name="placement">
Wide Skyscrapper 160 x 600
</tr>
<tr>
<td valign="top"><label for="code">Advertisement Code</label></td>
<td><textarea rows="5" cols="45" id="code" name="code"></textarea></td>
</tr>
<tr>
<td>Status</td>
<td><label>
<input type="radio" checked="checked" value="1" name="status">
Active</label>
<label>
<input type="radio" value="0" name="status">
Inactive</label></td>
</tr>
<input type="hidden" value="1" name="banner_uploaded" id="banner_uploaded">
<tr>
<td>For Country - </td>
<td>
<select id="country" name="country">
<option>Not posting all the names of country</option>
</select>
</td>
</tr>
<tr>
<td><label for="Scheduling">Valid From </label></td>
<td><input type="text" value="" id="date-from" name="date-from"> Format : dd/mm/yyyy:hh/mm</td>
</tr>
<tr>
<td><label for="Scheduling">Valid Till </label></td>
<td><input type="text" value="" id="date-to" name="date-to"> Format : dd/mm/yyyy:hh/mm</td>
</tr>
<tr>
<td> </td>
<td align="right"><input type="submit" onclick="return validate_ad_form(add_adv)" value="Update Advertisement" class="button" name="update"></td>
</tr>
</tbody></table>
</form>
But I am getting $_POST['code'] empty when I am passing HTML code through it.
When I pass plain text, it works fine.
When I printed $_POST [i.e. used - print_r($_POST) ], I got the following output -
Array ( [ad_id] => 15 [name] => Banner [placement] => ad_468x60 [code] => [status] => 1 [banner_uploaded] => 1 [country] => IN [date-from] => [date-to] => [update] => Update Advertisement )
Please be known, I haven't entered the 'date-from','date-to' fields.
I have entered on purpose as StackOverflow don't allow me to post images!
People,any help will be highly appreciated.
© Stack Overflow or respective owner